import { BaseColumnType, ClickColumnType, SwitchColumnType, TagsColumnType } from './common-table-type';

export const exBaseColumn: ClickColumnType = {
  name: 'click-column',
  prop: 'name',
  label: '姓名',
  width: 120,
  align: 'center',
  handle: (page, row) => {
    console.log('page data.checked1 :: ', (page as any).checked1);
    console.log('row form table :: ', row);

    console.log('点击单元格刷新表格：');
    (page as any).$refs.tableRef.initTableData();
  },
};

export const exFormatColumn: BaseColumnType = {
  name: 'base-column',
  prop: 'age',
  label: '年龄',
  width: 120,
  align: 'center',
  formatter: (row) => row.age + '岁',
};

export const exFormaeColumn: BaseColumnType = {
  name: 'base-column',
  prop: 'sex',
  label: '性别',
  width: 120,
  align: 'center',
  formatter: (row) => (row.sex ? '男' : '女'),
};

export const exSwitchColumn: SwitchColumnType = {
  name: 'switch-column',
  prop: 'isWork',
  label: '工作状态',
  width: 120,
  align: 'center',
  handle: (page, row) => {
    console.log('switchColumn row :: ', row);
    (page as any).$refs.tableRef.initTableData();
  },
};

export const exTextColumn: BaseColumnType = {
  name: 'base-column',
  prop: 'addr',
  label: '工作地址',
  align: 'left',
};

export const exTagsColumn: TagsColumnType = {
  name: 'tags-column',
  prop: 'tags',
  label: '标签',
  align: 'center',
  width: '220',
};
